
2
2
.
.
2
2
.
.
2
2
S
S
c
c
a
a
l
l
a
a
r
r
s
s
Scalar Data Types are implemented as Structures and can only store single value.
Scalar Data Types
Can only have nil value, It can only be assigned to optional.
Can only have logical true or false values.
Represents sequence of characters treated as a continuous group
Different signed integer data types can store signed integers of various sizes
Different unsigned integer data types can store unsigned integers of various sizes
Represents real number as 32-bit floating-point number.
Represents real number as 64-bit floating-point number.
Nil Data Type can only have nil value and can only be assigned to Optional either by
● explicitly setting Optional to nil using Nil Literal
● declaring Optional without assigning value to it in which case it is initialized to nil
Nil Data Type
var age : Int? //Optional variable is initialized to nil data type.
var weight : Int? = nil //Optional variable is set to nil data type using nil literal.
Bool Data Type can only have two possible values logical true or false and can be created using Boolean Literal.
Bool Data Type
var access1 = true
var access2 : Bool = false
String Data Type represents sequence of characters and can be created using String Literal.
String Data Type
var name1 = "John" //Implicit type definition.
var name2 : String = "John" //Explicit type definition.